home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1994 / MacHack 1994.toast / MacHack™ 1987-1994 / MacHack™ '91 / '91 Attendee Contributions / HackSplashƒ / hsCode.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-23  |  2.6 KB  |  118 lines  |  [TEXT/KAHL]

  1. /**************************************************************************
  2.  
  3.     Splash Hack
  4.     
  5.      INIT and trap patch done at MacHack 1991. A simple animation replaces
  6.     _SysBeep. The animation consists of a few PICTs loaded in the 
  7.     System Heap at startup. The patch code block is stuffed with references
  8.     to the storage and installed. This file is the patch code.
  9.     
  10.      This is not an example of good practice in the Macintosh environment!
  11.     Please consider this code - well you know - a HACK !!
  12.      
  13.     NOTICE: Distribution is restricted to non-commercial agencies, Internet 
  14.     (+other unix sites) and user groups, as long as this notice remains. 
  15.     Probably to people that know what they are doing also, but then again, 
  16.     who's to say ?!
  17.  
  18.  
  19.     File Created                                    20Jun91        bh
  20.  
  21.                                             NOESIS Software Construction
  22. ***************************************************************************/
  23. #include <types.h>
  24. #include <QuickDraw.h>
  25.  
  26. #define new_hdrs            0
  27.  
  28. #if(new_hdrs)
  29. #include <Windows.h>
  30. #else
  31. #include <WindowMgr.h>
  32. #endif
  33.  
  34.  
  35. #define    wT    5                                /* basic animation delay */
  36.  
  37. /*************************************************************************/
  38. pascal void main( short dur )
  39. {
  40.     GrafPtr                savP;
  41.     WindowPtr            win;
  42.     Rect                tR;
  43.     long                cnt;
  44.     long                savD3;
  45.     long                t;
  46.     PicHandle            resBase;
  47.  
  48.     asm {
  49.         bra                @c
  50. bas:    dc.l            0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0
  51.         dc.l            0,0,0,0
  52.     };
  53.     
  54. c:
  55.     SetRect( &tR, 60, 80, 416+60, 191+80 );
  56. #if(new_hdrs)
  57.     win = NewWindow(    (void*)0, &tR, 
  58.                         (ConstStr255Param)"\p", true, 2, 
  59.                         (WindowPtr)-1, false, 0 );
  60. #else
  61.     win = NewWindow(    (void*)0, &tR, 
  62.                         "\p", true, 2, 
  63.                         (WindowPtr)-1, false, 0 );
  64. #endif
  65.     GetPort( &savP );
  66.     SetPort( win );
  67.                                                                 /* bkgnd Pic */      
  68.       asm {
  69.           move.l        @bas,resBase
  70.           
  71.          move.l        resBase,-(SP)        ; picHandle
  72.           move.l        resBase,A0
  73.           move.l        (A0),A0
  74.           addq        #2,A0
  75.           move.l        A0,-(SP)            ; &picFrame
  76.            _DrawPicture
  77.       }; 
  78.     Delay( wT, &t );
  79.                                                                 /* Frames */
  80.     asm {
  81.         move.l        d3,savD3
  82.         move.l        #13,D3
  83. loop:    move.l        D3,D1
  84.         addq        #1,D1
  85.         move.l        #14,D0
  86.         sub            D1,D0
  87.         lsl            #2,D0
  88.           movea.l        (PC,-194,D0),A0        ; code dependant offset, 68020 addr mode
  89.          move.l        A0,-(SP)            ; picHandle[ cnt ]
  90.           move.l        (A0),A0
  91.           addq        #2,A0
  92.           move.l        A0,-(SP)            ; &picFrame
  93.            _DrawPicture
  94.        };
  95.     Delay( wT, &t );
  96.        asm {
  97.         dbf            D3,@loop
  98.         move.l        savD3,D3
  99.     };
  100.     
  101.       asm {          
  102.          move.l        resBase,-(SP)        ; bg picHandle
  103.           move.l        resBase,A0
  104.           move.l        (A0),A0
  105.           addq        #2,A0
  106.           move.l        A0,-(SP)            ; &picFrame
  107.            _DrawPicture
  108.       }; 
  109.  
  110.     Delay( wT*3, &t );
  111.       DisposeWindow( win );
  112.       SetPort( savP );
  113.     return;
  114. }
  115.  
  116.  
  117. /***************************** End of Listing *******************************/
  118.